﻿using System;
using System.Collections.Generic;
using System.Xml;
using System.Text;

namespace BfLib.Web
{
    public class RSSCategoryList
    {
        private List<RSSCategory> _categories;

        public RSSCategoryList(XmlNode node)
        {
            _categories = new List<RSSCategory>();

            if (node == null) return;
            XmlNodeList nodes = node.SelectNodes("category");
            if (nodes == null) return;

            string val, domain;

            foreach (XmlNode n in nodes)
            {
                if (n.Attributes["domain"] != null)
                    domain = n.Attributes["domain"].Value;
                else
                    domain = null;

                val = n.InnerText;

                this._categories.Add(new RSSCategory(val, domain));
            }
        }

        public List<RSSCategory> Categories
        {
            get
            {
                return _categories;
            }
        }
    }
}
